package leetcode.jianzhioffer;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-11-01 14:05
 **/
public class JianZhiOffer21 {
    public int[] exchange(int[] nums) {
        int slow = 0;
        int fast = 0;
        int len = nums.length;
        while (fast < len) {
            if ((nums[fast] & 1) == 1) {
                int temp = nums[slow];
                nums[slow++] = nums[fast];
                nums[fast] = temp;
            }
            fast++;
        }
        return nums;
    }
}
